package com.photoeditor.demo.model.bean.face;

import android.graphics.Point;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * @author lyzirving
 *         time        2018/11/1
 *         email       lyzirving@sina.com
 *         information
 */

public class FaceDetectBean extends BaseFaceScanBean implements Parcelable {

    private int expression;//微笑[0(normal)~50(smile)~100(laugh)]
    private int gender;//性别[0/(female)~100(male)]
    private int beauty;//魅力[0~100]
    private int roll;//平面旋转[-180,180]
    private int yaw;//左右偏移[-30,30]
    private int pitch;//上下偏移[-30,30]
    private int glasses;//眼镜[0不戴眼镜 1戴眼镜 2戴墨镜]
    private long faceId;
    private int hat;
    private int age;//年龄[0~100]
    private int mask;
    private int x;//人脸框左上角x
    private int y;//人脸框左上角y
    private int width;//人脸框宽度
    private int height;//人脸框高度
    private int imageWidth;//图片宽度
    private int imageHeight;//图片高度
    private boolean isTwoImage;//是否2张照片一起检测
    private List<Point> rightEye;
    private List<Point> leftEye;
    private List<Point> nose;
    private List<Point> faceProfile;//描述脸型轮廓的21点
    private List<Point> mouth;
    private List<Point> pupil;//瞳孔
    private List<Point> rightEyebrow;
    private List<Point> leftEyebrow;

    public void fixHeight(int heightValue) {
        for (int i = 0; i < rightEye.size(); i++) {
            rightEye.get(i).y -= heightValue;
        }
        for (int i = 0; i < leftEye.size(); i++) {
            leftEye.get(i).y -= heightValue;
        }
        for (int i = 0; i < nose.size(); i++) {
            nose.get(i).y -= heightValue;
        }
        for (int i = 0; i < faceProfile.size(); i++) {
            faceProfile.get(i).y -= heightValue;
        }
        for (int i = 0; i < mouth.size(); i++) {
            mouth.get(i).y -= heightValue;
        }
        for (int i = 0; i < pupil.size(); i++) {
            pupil.get(i).y -= heightValue;
        }
        for (int i = 0; i < rightEyebrow.size(); i++) {
            rightEyebrow.get(i).y -= heightValue;
        }
        for (int i = 0; i < leftEyebrow.size(); i++) {
            leftEyebrow.get(i).y -= heightValue;
        }
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getImageWidth() {
        return imageWidth;
    }

    public void setImageWidth(int imageWidth) {
        this.imageWidth = imageWidth;
    }

    public int getImageHeight() {
        return imageHeight;
    }

    public void setImageHeight(int imageHeight) {
        this.imageHeight = imageHeight;
    }

    public boolean isTwoImage() {
        return isTwoImage;
    }

    public void setTwoImage(boolean twoImage) {
        isTwoImage = twoImage;
    }

    public int getExpression() {
        return expression;
    }

    public void setExpression(int expression) {
        this.expression = expression;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public int getBeauty() {
        return beauty;
    }

    public void setBeauty(int beauty) {
        this.beauty = beauty;
    }

    public int getRoll() {
        return roll;
    }

    public void setRoll(int roll) {
        this.roll = roll;
    }

    public int getYaw() {
        return yaw;
    }

    public void setYaw(int yaw) {
        this.yaw = yaw;
    }

    public int getPitch() {
        return pitch;
    }

    public void setPitch(int pitch) {
        this.pitch = pitch;
    }

    public int getGlasses() {
        return glasses;
    }

    public void setGlasses(int glasses) {
        this.glasses = glasses;
    }

    public long getFaceId() {
        return faceId;
    }

    public void setFaceId(long faceId) {
        this.faceId = faceId;
    }

    public int getHat() {
        return hat;
    }

    public void setHat(int hat) {
        this.hat = hat;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getMask() {
        return mask;
    }

    public void setMask(int mask) {
        this.mask = mask;
    }

    public List<Point> getRightEye() {
        return rightEye;
    }

    public void setRightEye(List<Point> rightEye) {
        this.rightEye = rightEye;
    }

    public List<Point> getLeftEye() {
        return leftEye;
    }

    public void setLeftEye(List<Point> leftEye) {
        this.leftEye = leftEye;
    }

    public List<Point> getNose() {
        return nose;
    }

    public void setNose(List<Point> nose) {
        this.nose = nose;
    }

    public List<Point> getFaceProfile() {
        return faceProfile;
    }

    public void setFaceProfile(List<Point> faceProfile) {
        this.faceProfile = faceProfile;
    }

    public List<Point> getMouth() {
        return mouth;
    }

    public void setMouth(List<Point> mouth) {
        this.mouth = mouth;
    }

    public List<Point> getPupil() {
        return pupil;
    }

    public void setPupil(List<Point> pupil) {
        this.pupil = pupil;
    }

    public List<Point> getRightEyebrow() {
        return rightEyebrow;
    }

    public void setRightEyebrow(List<Point> rightEyebrow) {
        this.rightEyebrow = rightEyebrow;
    }

    public List<Point> getLeftEyebrow() {
        return leftEyebrow;
    }

    public void setLeftEyebrow(List<Point> leftEyebrow) {
        this.leftEyebrow = leftEyebrow;
    }

    public FaceDetectBean() {
        super();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeInt(this.expression);
        dest.writeInt(this.gender);
        dest.writeInt(this.beauty);
        dest.writeInt(this.roll);
        dest.writeInt(this.yaw);
        dest.writeInt(this.pitch);
        dest.writeInt(this.glasses);
        dest.writeLong(this.faceId);
        dest.writeInt(this.hat);
        dest.writeInt(this.age);
        dest.writeInt(this.mask);
        dest.writeInt(this.x);
        dest.writeInt(this.y);
        dest.writeInt(this.width);
        dest.writeInt(this.height);
        dest.writeInt(this.imageWidth);
        dest.writeInt(this.imageHeight);
        dest.writeByte(this.isTwoImage ? (byte) 1 : (byte) 0);
        dest.writeTypedList(this.rightEye);
        dest.writeTypedList(this.leftEye);
        dest.writeTypedList(this.nose);
        dest.writeTypedList(this.faceProfile);
        dest.writeTypedList(this.mouth);
        dest.writeTypedList(this.pupil);
        dest.writeTypedList(this.rightEyebrow);
        dest.writeTypedList(this.leftEyebrow);
    }

    protected FaceDetectBean(Parcel in) {
        super(in);
        this.expression = in.readInt();
        this.gender = in.readInt();
        this.beauty = in.readInt();
        this.roll = in.readInt();
        this.yaw = in.readInt();
        this.pitch = in.readInt();
        this.glasses = in.readInt();
        this.faceId = in.readLong();
        this.hat = in.readInt();
        this.age = in.readInt();
        this.mask = in.readInt();
        this.x = in.readInt();
        this.y = in.readInt();
        this.width = in.readInt();
        this.height = in.readInt();
        this.imageWidth = in.readInt();
        this.imageHeight = in.readInt();
        this.isTwoImage = in.readByte() != 0;
        this.rightEye = in.createTypedArrayList(Point.CREATOR);
        this.leftEye = in.createTypedArrayList(Point.CREATOR);
        this.nose = in.createTypedArrayList(Point.CREATOR);
        this.faceProfile = in.createTypedArrayList(Point.CREATOR);
        this.mouth = in.createTypedArrayList(Point.CREATOR);
        this.pupil = in.createTypedArrayList(Point.CREATOR);
        this.rightEyebrow = in.createTypedArrayList(Point.CREATOR);
        this.leftEyebrow = in.createTypedArrayList(Point.CREATOR);
    }

    public static final Creator<FaceDetectBean> CREATOR = new Creator<FaceDetectBean>() {
        @Override
        public FaceDetectBean createFromParcel(Parcel source) {
            return new FaceDetectBean(source);
        }

        @Override
        public FaceDetectBean[] newArray(int size) {
            return new FaceDetectBean[size];
        }
    };
}
